## Loading required package: psych
## Warning in as.POSIXlt.POSIXct(Sys.time()): unknown timezone 'zone/tz/2021a.1.0/
## zoneinfo/America/New_York'
## 
## Attaching package: 'ggplot2'
## The following objects are masked from 'package:psych':
## 
##     %+%, alpha
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
## Loading required package: viridisLite
## Loading required package: Matrix
## 
## Attaching package: 'Matrix'
## The following objects are masked from 'package:tidyr':
## 
##     expand, pack, unpack

Load/Clean Data

Assess Data

From Here to There

Merge

Time in Program

ggplot(
  data = a_pd,
  aes(x = avg_time_mins,
      fill = rdm_condition)) +
  geom_density(adjust = 1.5, alpha = .7) +
  xlim(0, 60) +
  theme_minimal() +
  labs(title = "Avg Session Time by Condition",
       x = "Avg Minutes per Assignment") +
  theme(plot.title = element_text(hjust = 0.5)
        )
## Warning: Removed 1696 rows containing non-finite values (stat_density).
ggplot(
  data = a_pd,
  aes(x = total_time_mins,
      fill = rdm_condition)) +
  geom_density(adjust = 1.5, alpha = .7) +
  xlim(0, 500) +
  theme_minimal() +
  labs(title = "Total Time by Condition",
       x = "Total Minutes in Program") +
  theme(plot.title = element_text(hjust = 0.5))
## Warning: Removed 1541 rows containing non-finite values (stat_density).

Problems Complete

ggplot(
  data = a_pd,
  aes(x = avg_problems_complete,
      fill = rdm_condition)) +
  geom_density(adjust = 1.5, alpha = .7) +
  xlim(0, 60) +
  theme_minimal() +
  labs(title = "Avg Problems per Session by Condition",
       x = "Avg Problems per Assignment") +
  theme(plot.title = element_text(hjust = 0.5))
## Warning: Removed 1675 rows containing non-finite values (stat_density).
ggplot(
  data = a_pd,
  aes(x = total_problems_complete,
      fill = rdm_condition)) +
  geom_density(adjust = 1.5, alpha = .7) +
  xlim(0, 500) +
  theme_minimal() +
  labs(title = "Total Problems Complete by Condition",
       x = "Total Problems Complete") +
  theme(plot.title = element_text(hjust = 0.5))
## Warning: Removed 1529 rows containing non-finite values (stat_density).

ggplot(
  data = a_pd,
  aes(x = total_problems_complete_z_withinProgram,
      fill = rdm_condition)) +
  geom_density(adjust = 1.5, alpha = .7) +
  xlim(-2.5,2.5) +
  theme_minimal() +
  labs(title = "Total Problems Complete by Condition (Standardized)",
       x = "Total Problems Complete (Z-Score)") +
  theme(plot.title = element_text(hjust = 0.5)
        )
## Warning: Removed 1539 rows containing non-finite values (stat_density).

# note that these z scores were created on the full sample of students who used each program (including conditions and schools dropped)

Total Problems By Time in Porgram

ggplot(
  data = a_pd[a_pd$rdm_condition != "Dragon", ],
  aes(x = total_problems_complete,
      y = total_time_mins,
      color = rdm_condition)) +
  geom_point(alpha = .7) +
   ylim(0, 500) +
  #   xlim(-2, 3) +
    geom_smooth(method = "lm", se = FALSE) +
  theme_minimal() +
  labs(title = "Problems Complete By Time in Program",
       x = "Total Problems Complete",
       y = "Total Time ") +
  theme(plot.title = element_text(hjust = 0.5)
        )
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 868 rows containing non-finite values (stat_smooth).
## Warning: Removed 868 rows containing missing values (geom_point).
ggplot(
  data = a_pd[a_pd$rdm_condition != "Dragon", ],
  aes(x = total_problems_complete_z_withinProgram,
      y = total_time_mins_z_withinProgram,
      color = rdm_condition)) +
  geom_point(alpha = .7) +
  ylim(-2, 3) +
    xlim(-2, 3) +
    geom_smooth(method = "lm", se = FALSE) +
  theme_minimal() +
  labs(title = "Problems Complete By Time in Program (Standardized)",
       x = "Total Problems Complete (Z-Score)",
       y = "Total Time (Z-Score)") +
  theme(plot.title = element_text(hjust = 0.5)
        )
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 871 rows containing non-finite values (stat_smooth).
## Warning: Removed 871 rows containing missing values (geom_point).
# note that these z scores were created on the full sample of students who used each program (incluing conditions and schools dropped)

Multivariate Bi-Modal Distributions

ggplot(a_pd[a_pd$rdm_condition != "Dragon", ],
  aes(x = fidelity_started_sum,
      y = total_problems_complete_z_withinProgram,)) +
  stat_density_2d() +
    geom_point(alpha = .5, aes(color = rdm_condition))+
    ylim(-2.5, 2.5) +
    xlim(0,15) +
  labs(title = "Problems Complete by Assignments Started (Standadized)",
       x = "Assignments Started",
       y = "Total Problems Complete (Z-score)",
       color = "Condition") +
    theme(plot.title = element_text(hjust = 0.5)
        ) +
  theme_minimal()
## Warning: Removed 870 rows containing non-finite values (stat_density2d).
## Warning: Removed 870 rows containing missing values (geom_point).

ggplot(a_pd[a_pd$rdm_condition != "Dragon", ],
  aes(x = fidelity_started_sum,
      y = total_problems_complete,)) +
  stat_density_2d() +
    geom_point(alpha = .5, aes(color = rdm_condition))+
    ylim(0, 400) +
    xlim(0,15) +
  labs(title = "Problems Complete By Assignments Started",
       x = "Assignments Started",
       y = "Total Problems Complete",
       color = "Condition") +
  theme_minimal()
## Warning: Removed 860 rows containing non-finite values (stat_density2d).
## Warning: Removed 860 rows containing missing values (geom_point).

ggplot(a_pd[a_pd$rdm_condition == "FH2T", ],
  aes(x = fidelity_started_sum,
      y = total_problems_complete,)) +
  stat_density_2d() +
    geom_point(alpha = .5)+
    ylim(0, 400) +
    xlim(0,15) +
  labs(title = "From Here to There", 
       x = "Assignments Started",
       y = "Total Problems Complete") +
  theme_minimal()
## Warning: Removed 279 rows containing non-finite values (stat_density2d).
## Warning: Removed 279 rows containing missing values (geom_point).
ggplot(a_pd[a_pd$rdm_condition == "ASSISTments", ],
  aes(x = fidelity_started_sum,
      y = total_problems_complete,)) +
  stat_density_2d() +
    geom_point(alpha = .5)+
    ylim(0, 400) +
    xlim(0,15) +
  labs(title = "ASSISTments",
       x = "Assignments Started",
       y = "Total Problems Complete") +
  theme_minimal()
## Warning: Removed 303 rows containing non-finite values (stat_density2d).
## Warning: Removed 303 rows containing missing values (geom_point).
ggplot(a_pd[a_pd$rdm_condition == "BAU", ],
  aes(x = fidelity_started_sum,
      y = total_problems_complete,)) +
  stat_density_2d() +
    geom_point(alpha = .5)+
    ylim(0, 400) +
    xlim(0,15) +
  labs(title = "BAU",
       x = "Assignments Started",
       y = "Total Problems Complete") +
  theme_minimal()
## Warning: Removed 278 rows containing non-finite values (stat_density2d).
## Warning: Removed 278 rows containing missing values (geom_point).

Between School/Class Variance

### Variance in fidelity by school
ggplot(
  a_pd[is.na(a_pd$final_school_id) == F, ],
  aes(x = final_school_id, 
      y = total_time_mins,
      grpup = rdm_condition,
      fill = rdm_condition
      )
) +
  labs(title ="Total Time by School and Condition",
    #   subtitle = "10 students with time > 500 mins not shown",
       y = "Total Minutes In Porgram") +
  geom_boxplot(alpha = .7) +
    ylim(0, 500) +
  theme_minimal()
## Warning: Removed 1541 rows containing non-finite values (stat_boxplot).
ggplot(
  a_pd[is.na(a_pd$final_school_id) == F, ],
  aes(x = final_school_id, 
      y = total_problems_complete,
      grpup = rdm_condition,
      fill = rdm_condition)
) +
  labs(title ="Problems Complete by School and Condition",
    #   subtitle = "10 students with time > 500 mins not shown",
       y = "Total Problems Complete  Porgram") +
  geom_boxplot(alpha = .7) +
 #   ylim(0, 500) +
  theme_minimal()
## Warning: Removed 1529 rows containing non-finite values (stat_boxplot).